public class StringBufferLength
	{
	public static void main (String[] args)
	{
		StringBuffer buf = new StringBuffer(20);
		buf.append("This is a book");
		System.out.println("StringBuffer: " + buf);
		System.out.println("Capacity: " + buf.capacity());
		System.out.println("Length: " + buf.length());
		System.out.println("------------------------------");
		buf.ensureCapacity(30);
		System.out.println("Capacity: " + buf.capacity());
		System.out.println("StringBuffer after ensureCapacity(30): " + buf);
		buf.setLength(10);
		System.out.println("Length: " + buf.length());
		System.out.println("StringBuffer after setLength(10): " + buf);
	}
}